Path: blob/master/src/packages/next/pages/store/[[...page]].tsx
5750 views
/*1* This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { Layout } from "antd";6import Error from "next/error";78import { capitalize } from "@cocalc/util/misc";9import Footer from "components/landing/footer";10import Head from "components/landing/head";11import Header from "components/landing/header";12import Store from "components/store";13import { StorePages } from "components/store/types";14import { Customize } from "lib/customize";15import withCustomize from "lib/with-customize";1617export default function Preferences({ customize, page, pageNotFound }) {18const subpage = page[0] != null ? ` - ${capitalize(page[0])}` : "";1920return (21<Customize value={customize}>22<Head title={`Store${subpage}`} />23<Layout>24<Header page={"store"} />25{pageNotFound ? <Error statusCode={404} /> : <Store page={page} />}26<Footer />27</Layout>28</Customize>29);30}3132export async function getServerSideProps(context) {33let { page } = context.params;34if (page == null) {35page = [];36}37if (page.length > 0 && !StorePages.includes(page[0])) {38return await withCustomize({39context,40props: { pageNotFound: true, page },41});42}4344return await withCustomize({ context, props: { page } });45}464748